FROM ubuntu

RUN mkdir /root/.ssh

RUN echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDc+4y9lKiOalgzdI2NBxoGRmccbC4dt0EzgoEyxW5YpcA22VuwP3cPeuevI8ysW8lQB8ilI5OVeL/v55efEwCzE1KcfgG+B2hUZ6CogNZoLpUC5MC91cxEwK8yhY6G7PJ/ktulIB4a0xgdfW1mtxldSGzfTYnGCRwSK4HckZxx5OK57/975g2BqzDyUHxQ33djtGJXgEGzyvbykaFq1TO61lJh2xfegGeSPnZZ6r03i3EiM57qE4bIHqlZnE4BIqD9gZKDO06X+92vQq5+mXnmL0tIZukLmq3xi6GnRNkWeaesemTBfw3373elZ06XB8YaWnXCLPD/6AgbYP08ab3H" > /root/.ssh/authorized_keys

RUN apt update

RUN apt install git vim htop locales python-software-properties software-properties-common -y

RUN locale-gen zh_CN.UTF-8

ENV LC_ALL="zh_CN.UTF-8"

RUN add-apt-repository ppa:ondrej/php -y

RUN apt update

RUN apt install php7.2 php7.2-dev openssh-server -y

ADD https://github.com/swoole/swoole-src/archive/v1.9.11.tar.gz v1.9.11.tar.gz

RUN tar -xzvf v1.9.11.tar.gz && cd swoole-src-1.9.11 && phpize && ./configure && make && make install

RUN echo "extension=swoole.so" > /etc/php/7.2/mods-available/swoole.ini

RUN phpenmod swoole

RUN mkdir /var/run/sshd /root/code

VOLUME /root/code/php

EXPOSE 22 80

CMD ["/usr/sbin/sshd", "-D"]
